package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
	/**
	 * 根据菜品id查询对应的套餐id
	 * @param dishIds
	 * @return
	 * select setmeal_dish from setmeal_dish where dish_id in (1,2,3)
	 */
	List<Long> getsetmealIdByDishIds(List<Long> dishIds);

	/**
	 * 批量新增套餐和菜品关系数据
	 * @param setmealDishs
	 */
	void insert(List<SetmealDish> setmealDishs);

	/**
	 * 批量删除套餐和菜品关系数据
	 * @param setmealIds
	 */
	void delete(List<Long> setmealIds);

	/**
	 * 根据套餐id获取套餐菜品关系
	 * @param setmealId
	 * @return
	 */
	@Select("select * from setmeal_dish where setmeal_id=#{setmealId} ")
	List<SetmealDish> getBySetmealId(Long setmealId);
}
